﻿using System;
using System.Threading;

namespace Progream14
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("主线程");
            Thread t = new Thread(new ThreadStart(Threadsd));
            t.Start();

            for(var i=0;i<4;i++)
            {
                Console.WriteLine("主线程做别的事");
                Thread.Sleep(0);
            }
            Console.WriteLine("主线程：要等Threadsd执行完成");
            //阻塞调用线程，指导某个线程执行完成为止
            t.Join();
            for(var i=5;i<10;i++)
            {
                Console.WriteLine("主线程做别的事");
                Thread.Sleep(0);
            }
        }
        private  static void Threadsd()
        {
            for(var i=0;i<10;i++)
            {
                Console.WriteLine("Thread:" + i);
            }
        }
    }
}
